package structures.log;

import exception.IBToolsException;
import manager.LogManager;

import structures.ServiceCallInfo;

class LogThread extends Thread {
	
	private LogData data;

	public LogThread(ServiceCallInfo callInfo, String errorType,
			String errorText) {
		
		data = new LogData(callInfo, errorType, errorText);
	}

	public LogThread(ServiceCallInfo callInfo) {
		data = new LogData(callInfo, null, null);
	}

	public void run() {
		try {
			if(data.getErrorType() == null){
				LogManager.logServiceCallSuccess(data);
			}
			else {
				LogManager.logServiceCallError(data);
			}
		} catch (IBToolsException e) {
			e.printStackTrace();
		}
	}
}
